<!--
<template>
  &lt;!&ndash; 添加或修改报销发票信息管理对话框 &ndash;&gt;
  <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body :close-on-click-modal="false" v-dialogDrag>
    <el-form ref="form" :model="form" :rules="rules" label-width="120px">
      <el-tabs v-model="activeName" class="detail-tab" type="card">
        <el-tab-pane label="基本信息" name="first">
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="报销类型" prop="type">
                <el-select v-model="form.type" placeholder="请选择报销类型" disabled>
                  <el-option
                    v-for="dict in dict.type.reimburse_type"
                    :key="dict.value"
                    :label="dict.label"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="报销人姓名" prop="userName">
                <el-input v-model="form.userName" placeholder="请输入报销人姓名" disabled/>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="报销日期" prop="imburseDate">
                <el-date-picker clearable disabled
                                v-model="form.imburseDate"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="请选择报销日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            &lt;!&ndash;<el-col :span="8">
              <el-form-item label="发票号码" prop="taxNo">
                <el-input v-model="form.taxNo" placeholder="请输入内容" disabled/>
              </el-form-item>
            </el-col>&ndash;&gt;
            <el-col :span="8">
              <el-form-item label="报销金额" prop="imburseMoney">
                <el-input v-model="form.imburseMoney" placeholder="请输入报销金额" disabled/>
              </el-form-item>
            </el-col>
            &lt;!&ndash;<el-col :span="8">
              <el-form-item label="报销状态">
                <el-radio-group v-model="form.status">
                  <el-radio disabled
                            v-for="dict in dict.type.imburse_status"
                            :key="dict.value"
                            :label="dict.value"
                  >{{dict.label}}
                  </el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>&ndash;&gt;
            <el-col :span="8">
              <el-form-item label="发放金额" prop="remMoney">
                <el-input v-model="form.remMoney" placeholder="发放金额" disabled style="width: 200px;"/>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="剩余发放金额" prop="remRemain">
                <el-input v-model="form.remRemain" placeholder="剩余发放金额" disabled style="width: 200px;"/>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="项目名称" prop="prjname" v-if="form.type == '0'">
                <el-input placeholder="请输入项目名称" v-model="form.prjname" disabled/>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="请款人开户行" prop="qkrkhh" v-if="form.type == '0'">
                <el-input placeholder="请输入请款人开户行" v-model="form.qkrkhh" disabled/>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="请款人账号" prop="qkrzh" v-if="form.type == '0'">
                <el-input placeholder="请输入请款人账号" v-model="form.qkrzh" disabled/>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="资金用途" prop="zjyt" v-if="form.type == '0'">
                <el-input placeholder="请输入资金用途(货款,运费 等)" v-model="form.zjyt" disabled/>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="请款事由" prop="qksy">
                <el-input placeholder="请输入请款事由" v-model="form.qksy" disabled/>
              </el-form-item>
            </el-col>
            &lt;!&ndash;<el-col :span="24">
              <el-form-item label="报销描述" prop="infomation">
                <el-input v-model="form.infomation" type="textarea" disabled placeholder="请输入内容"/>
              </el-form-item>
            </el-col>&ndash;&gt;
            <el-col :span="24">
              <el-form-item label="付款备注信息" prop="qkbz">
                <el-input placeholder="请输入付款备注信息(不需备注请填“无”)" type="textarea" v-model="form.qkbz" disabled/>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="其他备注信息" prop="infomation">
                <el-input type="textarea" v-model="form.infomation" placeholder="请输入备注"/>
              </el-form-item>
            </el-col>
          </el-row>
        </el-tab-pane>
      </el-tabs>
    </el-form>
    <el-tabs v-model="activeName" class="detail-tab" type="card" v-if="form.status == '2'">
      <el-tab-pane label="发放记录" name="first">
        <el-table border v-loading="loading" :data="dataList">
          <el-table-column label="发放标识" align="center" prop="companyName">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.company" :value="scope.row.companyName"/>
            </template>
          </el-table-column>
          <el-table-column label="发放日期" align="center" prop="grantDate">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.grantDate, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="发放金额" align="center" prop="grantMoney"/>
          &lt;!&ndash;<el-table-column label="发放状态" align="center" prop="status"/>&ndash;&gt;
          <el-table-column label="备注" align="center" prop="remark"/>
        </el-table>
      </el-tab-pane>
    </el-tabs>

    <el-tabs v-model="activeName" class="detail-tab" type="card">
      <el-tab-pane label="报销明细" name="first">
        <el-col :span="1.5">
          <el-button @click="handleExport()" icon="el-icon-download" plain size="mini" type="warning">导出</el-button>
        </el-col>
        <el-table v-loading="loadingOrderList" :data="orderList">
          <el-table-column label="商品名称" align="center" prop="name"/>
          <el-table-column label="商品品牌" align="center" prop="brand"/>
          <el-table-column label="商品型号" align="center" prop="model"/>
          <el-table-column label="商品单位" align="center" prop="unit"/>
          <el-table-column label="采购单价" align="center" prop="costPrice"/>
          <el-table-column label="采购数量" align="center" prop="count"/>
          &lt;!&ndash;<el-table-column label="库存数量" align="center" prop="remainderCount"/>&ndash;&gt;
          <el-table-column label="采购总价" align="center" prop="cost"/>
          <el-table-column label="采购人姓名" align="center" prop="buyName"/>
          <el-table-column label="采购日期" align="center" prop="buyDate" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.buyDate, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          &lt;!&ndash;<el-table-column label="采购方式" align="center" prop="buyType">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.reimburse_type" :value="scope.row.buyType"/>
            </template>
          </el-table-column>&ndash;&gt;
          &lt;!&ndash;      <el-table-column label="是否报销" align="center" prop="reimburse">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.yes_no" :value="scope.row.reimburse"/>
            </template>
          </el-table-column>
          <el-table-column label="供应商名称" align="center" prop="supplierName"/>&ndash;&gt;
          &lt;!&ndash;<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-popconfirm :title="`确认移除当前数据项？`" @confirm="handleDelete(scope.row)"
                             style="margin-left: 10px;">
                <el-button slot="reference" size="mini" type="text" icon="el-icon-delete"
                           >移除
                </el-button>
              </el-popconfirm>
            </template>
          </el-table-column>&ndash;&gt;
        </el-table>
      </el-tab-pane>
    </el-tabs>

    <div slot="footer" class="dialog-footer">
      &lt;!&ndash;      <el-button type="primary" @click="submitForm">确 定</el-button>&ndash;&gt;
      <el-button @click="cancel">关 闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
    import {addAction, getAction, getById, updateAction, downloadFile} from '@/api/manage'
    import moment from 'moment';

    export default {
        name: "GoodsReimbursementForm",
        dicts: ['reimburse_type', 'imburse_status', 'company'],
        data() {
            return {
                // 遮罩层
                loading: true,
                loadingOrderList: false,
                activeName: "first",
                // 弹出层标题
                title: "",
                reimburseId: "",
                // 是否显示弹出层
                open: false,
                // 表单参数
                form: {},
                dataList: [],
                orderList: [],
                // 表单校验
                rules: {},
                url: {
                    list: '/goodsReimbursementDetail/goodsReimbursementDetail/list',
                    getById: '/goodsReimbursement/goodsReimbursement/',
                    add: '/goodsReimbursement/goodsReimbursement/add',
                    edit: '/goodsReimbursement/goodsReimbursement/edit',
                },
                queryParams: {
                    reimburseId: null,
                },
            };
        },
        created() {

        },
        methods: {
            handleExport() {
                let that = this;
                that.loading = false;
                that.queryParams.imburseId = that.reimburseId;
                var id = that.reimburseId;
                that.$confirm('是否确认导出报销明细表?', "确认", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                }).then(function () {
                    downloadFile('/goodsReimbursement/goodsReimbursement/export', that.queryParams);
                });
            },
            getList() {
                let that = this;
                that.queryParams.reimburseId = that.reimburseId;
                getAction(that.url.list, this.queryParams).then(response => {
                    that.dataList = response.rows;
                    that.total = response.total;
                    that.loading = false;
                });
            },
            // 取消按钮
            cancel() {
                this.open = false;
                this.reset();
            },
            // 表单重置
            reset() {
                this.form = {
                    id: null,
                    type: null,
                    userId: null,
                    userName: null,
                    imburseDate: null,
                    taxId: null,
                    taxNo: null,
                    taxMoney: null,
                    infomation: null,
                    goodsIds: null,
                    file: null,
                    status: "0",
                    delFlag: null,
                    createBy: null,
                    createTime: null,
                    updateBy: null,
                    updateTime: null,
                    remark: null
                };
                this.resetForm("form");
            },
            /** 新增按钮操作 */
            handleAdd() {
                this.reset();
                this.open = true;
                this.title = "添加报销发票信息管理";
            },
            /** 修改按钮操作 */
            handleUpdate(row) {
                this.reset();
                const id = row.id || this.ids;
                getById(this.url.getById, id).then(response => {
                    this.form = response.data;
                    this.orderList = this.form.orderList;
                    this.open = true;
                    this.title = "报销详情";
                });
                this.reimburseId = id.toString();
                this.getList();
            },
            /** 提交按钮 */
            submitForm() {
                this.$refs["form"].validate(valid => {
                    if (valid) {
                        if (this.form.id != null) {
                            updateAction(this.url.edit, this.form).then(response => {
                                this.$modal.msgSuccess("修改成功");
                                this.open = false;
                                this.$emit('ok');
                            });
                        } else {
                            addAction(this.url.add, this.form).then(response => {
                                this.$modal.msgSuccess("新增成功");
                                this.open = false;
                                this.$emit('ok');
                            });
                        }
                    }
                });
            },
        }
    };
</script>
-->
